<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<input type="number" id="num1" />

		<select name="" id="fuhao">
			<option value="-">-</option>
			<option value="+">+</option>
			<option value="*">*</option>
			<option value="/">/</option>
		</select>
		<input type="number" id="num2" />
		<input type="button" name="" id="btn" value="计算" />
		<input type="text" id="res" />


		<script type="text/javascript">
			//计算器的作业
			//给按钮添加事件
			btn.onclick = function() {
				//点击后获取值和符号
				var n1 = Number(num1.value);
				var n2 = Number(num2.value);
				var fh = fuhao.value;
				if (fh === '+') {
					res.value = n1 + n2;
				} else if (fh === '-') {
					res.value = n1 - n2;
				} else if (fh === '*') {
					res.value = n1 * n2;
				} else if (fh === '/') {
					res.value = n1 / n2;
				}

			}
		</script>
	</body>
</html>
